package com.example.djetpack.lifecycle

import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner


/**
 * Author: shuhong
 * Date: 2020/9/9 17:30
 * Description:
 */
class LocationObserver2 : LifecycleEventObserver {

    override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
        when(event){
            Lifecycle.Event.ON_START->{
                Log.d(Companion.TAG, "onStart方法被调用 ${event.name}")
            }
            Lifecycle.Event.ON_STOP->{
                Log.d(Companion.TAG, "onStop方法被调用 ${event.name}")
            }
        }
    }

    companion object {
        private const val TAG = "LocationObserver2"
    }
}